<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
 <head>
  <title>物流仓库信息表</title>
  <t:base type="jquery,easyui,tools,DatePicker"></t:base>
  <script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
  <script type="text/javascript">
      $(document).ready(function () {
          $.ajax({
              type:"GET",
              url:"cbsWarehouseController.do?getLogistics",
              dataType:"json",
              success:function (data) {
                  var name = $("#logists").val();
                  var tbs = data.obj;
                  var  htmll = "<option>--请选择--</option>";
                  for (i in tbs){
                      if (tbs[i].departname==name){
                          htmll += '<option  value='+tbs[i].departname+' selected="selected">'+tbs[i].departname+'</option>';
                      }else {
                          htmll += '<option  value='+tbs[i].departname+'>'+tbs[i].departname+'</option>';
                      }

                  }
                  $("#logistics").html(htmll);

              }
          })
          $.ajax({
              type:"GET",
              url:"cbsWarehouseController.do?getProvince",
              dataType:"json",
              success:function (data) {
                  var name = $("#shengName").val();
                  var tbs = data.obj;
                  var  html = "<option>--请选择--</option>";
                  for (i in tbs){
                      if (tbs[i].id==name){
                          html += '<option  value='+tbs[i].territoryCode+' selected="selected">'+tbs[i].territoryName+'</option>';
					  }else {
                          html += '<option  value='+tbs[i].territoryCode+'>'+tbs[i].territoryName+'</option>';
					  }

                  }
                  $("#sheng").html(html);

              }
          })
          var province = $("#sheng").val();
          $.ajax({
              type:"GET",
              data:{"code":province},
              url:"cbsWarehouseController.do?getCity",
              dataType:"json",
              success:function (data) {
                  var tbs = data.obj;
                  var  html = "";
                  var cityName = $("#cityName").val();
                  for (i in tbs){
                      if (tbs[i].id==cityName){
                          html += "<option value="+tbs[i].id+" selected='selected'>"+tbs[i].territoryName+"</option>";
                      }else {
                          html += "<option value="+tbs[i].id+">"+tbs[i].territoryName+"</option>";
                      }

                  }
                  $("#city").html(html);

              }
          })
      })
      function getCity() {
          var province = $("#sheng").val();
          $.ajax({
              type:"GET",
              data:{"code":province},
              url:"cbsWarehouseController.do?getCity",
              dataType:"json",
              success:function (data) {
                  var tbs = data.obj;
                  var  html = "";
                  var cityName = $("#cityName").val();
                  for (i in tbs){
                      if (tbs[i].id==cityName){
                          html += "<option value="+tbs[i].id+" selected='selected'>"+tbs[i].territoryName+"</option>";
					  }else {
                          html += "<option value="+tbs[i].id+">"+tbs[i].territoryName+"</option>";
					  }

                  }
                  $("#city").html(html);

              }
          })
      }
      function updateWare() {
          var id = $("#id").val();
          var name = $("#name").val();
          var code = $("#code").val();
          if (name==code){
              alert("同一物流仓库名称和代码不能重复");
              return false;
          }
          var logistics = $("#logistics").val();
          var province = $("#sheng").val();
          var city = $("#city").val();
		  $.ajax({
              type:"GET",
              data:{"id":id,"name":name,"code":code,"logistics":logistics,"province":province,"city":city},
              url:"cbsWarehouseController.do?doUpdate",
              dataType:"json",
              success:function (data) {
                  jQuery.messager.confirm('提示:','确定要修改吗?',function(event){
                      if(event){
                          window.location.href="cbsWarehouseController.do?cbsWarehouse";
                      }else{
                          // alert("你点击的是false");
                      }
                  });

              }
		  })
      }
  </script>
 </head>
 <body>
  <%--<t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" action="cbsWarehouseController.do?doUpdate" tiptype="1">--%>
					<input id="id" name="id" type="hidden" value="${cbsWarehousePage.id }">
					<input id="createName" name="createName" type="hidden" value="${cbsWarehousePage.createName }">
					<input id="createBy" name="createBy" type="hidden" value="${cbsWarehousePage.createBy }">
					<input id="createDate" name="createDate" type="hidden" value="${cbsWarehousePage.createDate }">
					<input id="updateName" name="updateName" type="hidden" value="${cbsWarehousePage.updateName }">
					<input id="updateBy" name="updateBy" type="hidden" value="${cbsWarehousePage.updateBy }">
					<input id="updateDate" name="updateDate" type="hidden" value="${cbsWarehousePage.updateDate }">
  <div style="margin-bottom:10px;">
	  <img style="margin-bottom:-7px" src="../plug-in/login/images/dispatch bill.png">
	  <div style="position: absolute; text-align: center; width: 100%; margin-top:-20px;">
		  <a href="#" class="easyui-linkbutton l-btn" onclick="reTurn()">返回</a>
	  </div>
  </div>

  <div class="subtitle">
	  <p>基本信息</p>
	  <table class="nobordertable noborder">
		  <tbody>
		  <tr>
			  <td class="al_r" width="20%">
				  <label>仓库名称:</label>
			  </td>
			  <td width="30%">
				  <input id="name" name="name" type="text" style="width: 150px" class="inputxt"
						 value='${cbsWarehousePage.name}' disabled="disabled">
			  </td>
			  <td class="al_r" width="20%">
				  <label>物流:</label>
			  </td>
			  <td width="30%">
				  <select id="logistics" disabled="disabled">
					  <%--<option <c:if test="${cbsWarehousePage.logistics eq '配思'}">selected</c:if>>配思</option>--%>
					  <%--<option <c:if test="${cbsWarehousePage.logistics eq '乔达'}">selected</c:if>>乔达</option>--%>
				  </select>
			  </td>
		  </tr>
		  <tr>
			  <td class="al_r" width="20%">
				  <label>仓库代码:</label>
			  </td>
			  <td width="30%">
				  <input id="code" name="code" value='${cbsWarehousePage.code}' type="text" disabled="disabled"/>
				  <input id="shengName" value='${cbsWarehousePage.sheng.id}' type="hidden"/>
				  <input id="cityName" value='${cbsWarehousePage.shi.id}' type="hidden"/>
				  <input id="logists" value='${cbsWarehousePage.logistics }' type="hidden"/>
			  </td>
			  <td class="al_r" width="20%">
				  <label>仓库所在地:</label>
			  </td>
			  <td width="30%">
				  <select style="width: auto;" id="sheng" name="sheng.id" onchange="getCity()" disabled="disabled">
					  <%--<option>北京</option>--%>
				  </select>
				  <select style="width: auto;" name="shi.id" id="city" disabled="disabled">
					  <option>--请选择--</option>
				  </select>
			  </td>
		  </tr>
		  <tr>
			  <td class="al_r" width="20%">
				  <label>联系人姓名:</label>

			  </td>
			  <td width="30%">
				  <input id="userName" type="text" class="inputxt" value="${cbsWarehousePage.userName}" disabled="disabled"/>
			  </td>
			  <td class="al_r" width="20%"><label>详细地址:</label></td>
			  <td width="30%"><input style="width:80%" id="address" type="text" class="inputxt" disabled="disabled" name="address" value="${cbsWarehousePage.address}">

			  </td>

		  </tr>
		  <tr>
			  <td class="al_r" width="20%">
				  <label>联系人邮箱:</label>
			  </td>
			  <td width="30%">
				  <input id="email" type="text" class="inputxt" disabled="disabled" value="${cbsWarehousePage.email}"/>

			  </td>
			  <td class="al_r" width="20%">
				  <label>联系人电话:</label>
			  </td>
			  <td width="30%">
				  <input id="phone" type="text" class="inputxt" disabled="disabled" value="${cbsWarehousePage.phone}"/>
			  </td>
		  </tr>
		  </tbody>
	  </table>
	  <div style="margin-top:10px;">
		  SL1目的地城市:
		  <div class="l-div" style="height: auto">
			  <c:forEach items="${slaOne}" var="one">
			  <span>${one.territoryName}</span>&nbsp;&nbsp;
			  </c:forEach>
		  </div>
	  </div>
	  <div style="margin-top:10px;">
		  SL2目的地城市:
		  <div class="l-div" style="height: auto">
			  <c:forEach items="${slaTwo}" var="two">
				  <span>${two.territoryName}</span>&nbsp;&nbsp;
			  </c:forEach>
		  </div>
	  </div>
	  <div style="margin-top:10px;">
		  SL3目的地城市:
		  <div class="l-div" style="height: auto">
			  <c:forEach items="${slaThree}" var="three">
				  <span>${three.territoryName}</span>&nbsp;&nbsp;
			  </c:forEach>
		  </div>
	  </div>
	  <div style="margin-top:10px;">
		  SL4目的地城市:
		  <div class="l-div" style="height: auto">
			  <c:forEach items="${slaFour}" var="four">
			  <span>${four.territoryName}</span>&nbsp;&nbsp;
			  </c:forEach>
		  </div>
	  </div>
  </div>
		<%--</t:formvalid>--%>
 <script>
	 function reTurn() {
         setTimeout("  addOneTab(\"物流仓库管理\",'cbsWarehouseController.do?cbsWarehouse');",1000);
         setTimeout("closetab('查看')",1000);
     }
 </script>
 </body>
  <script src = "webpage/com/zybk/cbswarehouse/cbsWarehouse.js"></script>